class Fc3d():
    def __init__(self):
        self.numbers=[]
        self.generNumer()
        self.printColumn = 40

    def generNumer(self):
        sums = ''
        self.numbers =[]
        for i in range(10):
            for j in range(10):
                for k in range(10):
                    sums = str(i)+str(j)+str(k)
                    self.numbers.append(sums)
    def printNums(self):
        print()
        print('【过滤后:', len(self.numbers), '注】')
        print('=' * 80)
        for i,d in enumerate(self.numbers):
            print(d,end=' ')
            if (i+1) % self.printColumn == 0:
                print('')

    def printNumsKill(self,_nums):
        print()
        print('=' * 80)
        for i,d in enumerate(_nums):
            print(d,end=' ')
            if (i+1) % self.printColumn == 0:
                print('')
    def _get_kuadu(self,_num):
        if len(_num)!=3:
            print("跨度号码没有3位")
            exit()
        return int(_num[2])-int(_num[0])

    # 杀跨度
    def kill_kuadu(self,*_kuadu,_print =True):
        kresult = []
        result =[]
        for num in self.numbers:
            n = self._get_kuadu(sorted(list(num)))
            if n in _kuadu :
                kresult.append(num)
            else:
                result.append(num)
        print()
        print('跨度: ', _kuadu, ' 过滤 ', len(kresult),' 注')
        if _print:
            print(kresult)
        self.numbers = result

    # 杀和值
    def kill_sum(self,*_sum,_print=True):
        kresult = []
        result =[]
        for num in self.numbers:
            s = sum([int(i) for i in list(num)])
            if s in _sum:
                kresult.append(num)
            else:
                result.append(num)
        print('\n')
        print('和值: ', _sum, ' 过滤 ', len(kresult), ' 注')
        if _print:
            print(kresult)
        self.numbers=result

    def get_danma(self,_dm ='',_cnt=1,_print =True):
        kresult =[]
        result =[]
        for num in self.numbers:
            c = set(_dm) & set(num)

            if len(c) >=_cnt:
                result.append(num)
            else:
                kresult.append(num)

        print('胆码: ', _dm, ' 过滤 ', len(kresult), ' 注')
        if _print:
            self.printNumsKill(kresult)
        self.numbers =result


    def dingwei(self,_dm,_pos,_print=True):
        result=[]
        kresult =[]
        for num in self.numbers:

            if num[_pos-1] in _dm:
                kresult.append(num)
            else:
                result.append(num)
        print()
        print('定位: ',_dm,' 过滤',len(kresult),' 注')
        if _print:
            print(kresult)
        self.numbers =result

    def fenli_zusan(self):
        zusan,zuliu=[],[]
        for n in self.numbers:
            c = set(n)
            if len(c) == 3:
                zuliu.append(n)
            else:
                zusan.append(n)
        print()
        print('*'*80)
        print('总计:',len(self.numbers),' 注 组三:',len(zusan),' 注 组六:',len(zuliu),'注')
        for i,x in enumerate(zusan):
            print(x,end=' ')
            if (i+1) % 20 == 0:
                print('')
        print()
        print('*' * 80)
        for i,x in enumerate(zuliu):
            print(x,end=' ')
            if (i+1) % 20 == 0:
                print('')

    def kill_mid(self,_print =True):
        result=[]
        kresult =[]
        for num in self.numbers:
            if num[0] == num[2] :
                kresult.append(num)
            else:
                result.append(num)
        print()
        print('杀中对: 过滤',len(kresult),' 注')
        if _print:
            print(kresult)
        self.numbers =result

d3= Fc3d()

d3.get_danma('012879',2)
# d3.kill_kuadu([0,9,8])
d3.dingwei('0',1)


d3.printNums()
d3.fenli_zusan()
print(len(d3.numbers))